#include <bits/stdc++.h>
using namespace std;
const int N = 405, mod = 1e9 + 7;
int n;
typedef long long ll;
ll a[N][N << 1];
ll qexp(ll x, int k) {
  ll ans = 1;
  while (k) {
    if (k & 1) ans = ans * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return ans % mod;
}

void jordan() {
  for (int i = 1; i <= n; ++i) {
    int r = i;
    for (int j = i + 1; j <= n; ++j)
      if (a[j][i] > a[r][i]) r = j;
    if (r != i) swap(a[i], a[r]);
    if (!a[i][i]) {
      puts("No Solution");
      return;
    }

    int inv = qexp(a[i][i], mod - 2);
    for (int k = 1; k <= n; ++k) {
      if (k == i) continue;
      int p = a[k][i] * inv % mod;
      for (int j = i; j <= (n << 1); ++j) {
        a[k][j] = ((a[k][j] - p * a[i][j]) % mod + mod) % mod;
      }
    }
  }

  for (int i = 1; i <= n; ++i) {
    for (int j = n + 1; j <= (n << 1); ++j) printf("%lld ", a[i][j]);
    putchar('\n');
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> a[i][j], a[i][i + n] = 1;

  jordan();
  return 0;
}
